
*********************************************
****   Description   ************************
*********************************************

* This program generates "Figure 3. Deposits and Loans across Race and Branches" including four pie charts comparing depositors and loan volumes by race and branch location. 

set scheme s2mono

*********************************************
****   Loan Results by Race/Branch ********** 
*********************************************

* Loan Face Value by Race  
use "$Data/Loan_Database_December2024.dta", clear

keep if audited=="yes" // results among audited loans only : 328 Loans and 60% of loan volumes.

collapse (sum) facevalue, by(race)
drop if race == "unknown" 
replace race = "African American" if race == "black"
replace race = "White" if race == "white"

graph pie facevalue, over(race) sort plabel(1 name, gap(5) size(vlarge)) plabel(2 name, gap(-15) size(vlarge)) plabel(_all percent, format(%3.0f) size(vlarge) gap(-5)) legend(off)  pie(1,color("75 75 75")) pie(2,color("230 230 230")) graphregion(fcolor(white)) ///



* Loan Face Value by Branch 
use "$Data/Loan_Database_December2024.dta", clear
collapse (sum) facevalue, by(branch)
drop if branch == "" 
replace branch="Other Branches" if branch=="Beaufort"|branch=="Memphis "

graph pie facevalue, over(branch) sort plabel(1 name, gap(12) size(vlarge)) plabel(2 name, gap(8) size(vlarge)) plabel(3 name, gap(6) size(vlarge)) plabel(4 name, gap(-15) size(vlarge)) plabel(_all percent, format(%3.0f) size(vlarge) gap(-5)) legend(off)  pie(1,color("75 75 75")) pie(2,color("105 105 105")) pie(3,color("145 145 145"))  pie(4,color("230 230 230")) graphregion(fcolor(white)) ///



*********************************************
****   Deposit Results by Race/Branch *******
*********************************************

* Number of deposits by Race  
use "$Data/BankRecords_Race_Collapse_December2024.dta", clear

graph pie race_count, over(race) sort plabel(2 name, gap(-15) size(vlarge)) plabel(1 name, gap(5) size(vlarge)) plabel(_all percent, format(%3.0f) size(vlarge) gap(-5)) legend(off)  pie(2,color("75 75 75")) pie(1,color("230 230 230")) graphregion(fcolor(white)) ///



* Number of deposits by Branch   
use "$Data/BankRecords_Branch_Collapse_December2024.dta", clear

collapse (sum) branch_count, by(branch) 

graph pie branch_count, over(branch) sort plabel(1 name, gap(12) size(vlarge)) plabel(2 name, gap(8) size(vlarge)) plabel(3 name, gap(6) size(vlarge)) plabel(4 name, gap(6) size(vlarge)) plabel(5 name, gap(-15) size(vlarge)) plabel(_all percent, format(%3.0f) size(vlarge) gap(-6)) legend(off)  pie(1,color("95 95 95")) pie(2,color("105 105 105")) pie(3,color("145 145 145"))  pie(4,color("230 230 230")) pie(5,color("75 75 75")) graphregion(fcolor(white)) ///
 


